import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {BaseModule} from '@sb/base';
import {FormsModule} from '@angular/forms';
import {LayerChangeComponent} from './panels/layer-change/layer-change.component';
import {MapZoomComponent} from './panels/map-zoom/map-zoom.component';
import {TopRightToolbarComponent} from './panels/top-right-toolbar/top-right-toolbar.component';
import {ZoomExtentComponent} from './funcs/zoom-extent/zoom-extent.component';
import {BaseMapComponent} from './base-map/base-map.component';
import {transform} from 'ol/proj';
import {MapFullScreenComponent} from './panels/map-full-screen/map-full-screen.component';
import {SB_MAP_OPTION_INTERCEPTOR, DcMapOptions} from './entity/dc-map-options';
import {MapService} from './service/map.service';
import {VectorLayerComponent} from './funcs/base-layer/vector-layer.component';


@NgModule({
    imports: [
        CommonModule,
        BaseModule,
        FormsModule,
    ],
    providers: [
        MapService,
        {
            provide: SB_MAP_OPTION_INTERCEPTOR,
            useValue: {
                viewOption: {
                    center: transform([113.077558, 22.578638], 'EPSG:4326', 'EPSG:3857'),
                    zoom: 10,
                    minZoom: 4,
                    maxZoom: 18
                },
                projectionOption: 'EPSG:3857',
                tk: 'fa14254e9ff21f58a612e254fea8d4d9',
                controlOption: {
                    layerChangeControl: true,
                    mapZoomControl: true,
                    scaleLineControl: false
                }
            } as DcMapOptions
        }
    ],
    declarations: [
        BaseMapComponent,
        LayerChangeComponent,
        MapZoomComponent,
        TopRightToolbarComponent,
        ZoomExtentComponent,
        MapFullScreenComponent,
        VectorLayerComponent
    ],
    exports: [
        BaseMapComponent,
        LayerChangeComponent,
        MapZoomComponent,
        TopRightToolbarComponent,
        ZoomExtentComponent,
        MapFullScreenComponent,
        VectorLayerComponent
    ],
    entryComponents: [
        LayerChangeComponent,
        MapZoomComponent,
        TopRightToolbarComponent,
        ZoomExtentComponent
    ]
})
export class BaseMapModule {
}
